//
//  main.cpp
//  phi_four
//
//  Created by Snir Gazit on 3/6/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#include <iostream>
#include "Lattice.h"
#include "../HelpLibs/def.h"
#include "../HelpLibs/InputFile.h"
#include "Simulation.h"

template<class ALG>
void run(string inFile);

template<class ALG>
void run(string inFile) {
	// Read File
	InputFile inPutFile(inFile);
	inPutFile.readFile();
	// Simulate
	ALG sim;
	sim.init(inPutFile.getQmcParams());
	bool init = inPutFile.getQmcParams().initFromFile.getVal();
	if (!init)
		if (inPutFile.getQmcParams().simulateAnnealing.getVal())
			{
			sim.simulatedAnnealing();
			}
		else
			sim.thermalize();
	bool done = sim.run();
	sim.dump(true);
	if (done)
		cout << "yes";
	else
		cout << "no";
}

int main(int argc, const char * argv[]) {
	if (argc == 1)
		exit(-1);
	string inFile(argv[1]);
	run<OnModel>(inFile);
	return 0;
}
